const eventSource = new EventSource('/xz_server/main/getNvidiaAiAnswer');

eventSource.onmessage = (event) => {
  if (event.data === '[DONE]') {
    eventSource.close();
    return;
  }
  
  const data = JSON.parse(event.data);
  // 处理接收到的数据
  console.log(data);
  output += data;
};

eventSource.onerror = (error) => {
  console.error('EventSource error:', error);
  eventSource.close();
};